package com.xiaoyu.base.dao;

import androidx.room.Dao;
import androidx.room.Delete;
import androidx.room.Insert;
import androidx.room.Query;

import com.xiaoyu.base.entity.StickerPackage;

import java.util.List;

import static androidx.room.OnConflictStrategy.*;

@Dao
public interface StickerPackageDao {

    @Insert(onConflict = REPLACE)
    void insert(StickerPackage stickerPackage);

    @Insert(onConflict = REPLACE)
    void insertAll(List<StickerPackage> list);

    @Delete
    void delete(StickerPackage stickerPackage);

    @Query("DELETE FROM sticker_package WHERE packageId IN (:packageId)")
    void delete(long packageId);

    @Query("DELETE FROM sticker_package")
    void deleteAll();

    @Query("SELECT * FROM sticker_package ORDER BY ord ASC")
    List<StickerPackage> getAllStickerPackages();

    @Query("SELECT * FROM sticker_package ORDER BY ord ASC LIMIT 1")
    StickerPackage getStickerPackageForMinOrd();
}
